<%@page import="java.io.PrintWriter"%>
<%@page import="java.io.IOException"%>
<%@page import="java.io.FileOutputStream"%>
<%
    //String nameOfTextFile = "/uk/";
    try {

        String real_filename = getServletContext().getRealPath("/");

        HttpSession s = request.getSession(true);


        real_filename += "data.xml";

        PrintWriter pw = new PrintWriter(new FileOutputStream(real_filename));


        if (s.getAttribute("topology") != null && !s.getAttribute("topology").equals("")) {

            pw.println(s.getAttribute("topology"));
        } else {

            pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                    + "<evolve-config xmlns=\"urn:celona-com:schema/celona/evolve/config/0.9\" "
                    + " xmlns:xi=\"http://www.w3.org/2001/XInclude\" model=\"\">");


        }










        if (s.getAttribute("ManagedItems") != null) {

            pw.println(s.getAttribute("ManagedItems"));
        }







        /*
         if (s.getAttribute("topolgy_systems") != null) {

         pw.println(s.getAttribute("topolgy_systems"));
         }*/

        if (s.getAttribute("stat_modelName") != null) {

            String modna = "";
            if (!s.getAttribute("stat_modelName").equals("undefined")) {

                modna = (String) s.getAttribute("stat_modelName");


            }
            pw.println("<migration-state-model name='" + modna + "'>");


            if (s.getAttribute("itemOperation") != null) {

                pw.println(s.getAttribute("itemOperation"));
            }

            if (s.getAttribute("stat") != null) {

                pw.println(s.getAttribute("stat"));
            }
            pw.println("</migration-state-model>");

        }






        if (s.getAttribute("dir") != null) {

            pw.println(s.getAttribute("dir"));
        }


        pw.println("</evolve-config>");




        pw.close();
        out.println(real_filename);

    } catch (IOException e) {
        out.println(e.getMessage());
    }%>





